version: '3'
services:
  redis:
    container_name: redis
    hostname: redis
    restart: always
    depends_on:
      - mysql
    image: redis:7.2-alpine
    ports:
      - "6379:6379"

  nginx:
    container_name: nginx
    hostname: nginx
    restart: always
    depends_on:
      - redis
      - php-fpm
      - mysql
    build:
      context: ./docker/nginx
      dockerfile: Dockerfile
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./www/html:/var/www/html


  php-fpm:
    container_name: php-fpm
    hostname: php-fpm
    restart: always
    depends_on:
      - redis
      - mysql
    build:
      context: ./docker/php-fpm
      dockerfile: Dockerfile
    ports:
      - "9000:9000"
    volumes:
      - ./www/html:/var/www/html


  mysql:
    container_name: mysql
    hostname: mysql
    restart: always
    image: mysql:8.4.0
    ports:
      -  "3306:3306"
    volumes:
      - ./docker/mysql/data:/var/lib/mysql
      - ./docker/mysql/config:/etc/mysql/conf.d

    environment:
      MYSQL_ROOT_PASSWORD: 12345
      MYSQL_DATABASE: laravel
      MYSQL_USER: user
      MYSQL_PASSWORD: 12345
      TZ: Asia/Yekaterinburg





